package com.cloudm.technician.di

import com.cloudm.technician.data.network.CloudmBoxApi
import com.cloudm.technician.data.network.CommonApi
import com.cloudm.technician.data.network.PersonalApi
import com.qiniu.android.storage.UploadManager
import dagger.Module
import dagger.Provides
import retrofit2.Retrofit
import javax.inject.Singleton

/**
 * 作者: wesley
 * 时间: 2017/11/20
 * 描述: 提供api的实例
 */
@Module(includes = [(NetworkModule::class)])
class ApiModule {


    @Singleton
    @Provides
    fun provideCommonApi(retrofit: Retrofit): CommonApi = retrofit.create(CommonApi::class.java)


    @ForUploadPic
    @Singleton
    @Provides
    fun provideCommonApiForUpLoadPic(@ForUploadPic retrofit: Retrofit): CommonApi = retrofit.create(
            CommonApi::class.java)


    @Singleton
    @Provides
    fun providePersonalApi(retrofit: Retrofit): PersonalApi = retrofit.create(
            PersonalApi::class.java)

    @Provides
    @Singleton
    fun provideCloudmBoxApi(retrofit: Retrofit): CloudmBoxApi = retrofit.create(
            CloudmBoxApi::class.java)

    @ForCloudm
    @Singleton
    @Provides
    fun provideCloudmBoxApiForCloudm(@ForCloudm retrofit: Retrofit): CloudmBoxApi = retrofit.create(
            CloudmBoxApi::class.java)


    @Singleton
    @Provides
    fun provideUploadManager() = UploadManager()
}